Trò chơi đua xe động vật trong UNITY Engine
114.921 lượt xem;
- AchievementLayer.cs
- MainMenu /
- AnimalRacing /
- Scripts /
- Assets /
- project /
1 using UnityEngine;
2 using System.Collections;
3
4 public class AchievementLayer : MonoBehaviour {
5
6 private Vector2 scrollPosition;
7 private Rect bounds;
8
9 private void Start()
10 {
11 scrollPosition = Vector2.zero;
12 bounds = new Rect(128, 68, 538, 322);
13 }
14
15 private void OnGUI()
16 {
17
18 /*
19 GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(Screen.width / 800f, Screen.height / 480f, 1f));
20 GUI.BeginGroup(bounds);
21
22 // GUILayout.BeginHorizontal(GUILayout.Width(538), GUILayout.Height(322));
23
24 GUILayout.BeginScrollView(scrollPosition, GUIStyle.none);
25
26 for (int i = 0; i < 100; i++)
27 {
28 // GUI.Button(new Rect(0, 100 * i, 100, 30), "asdasdadsasd");
29 GUILayout.Button("aaaaaa");
30 }
31 //GUILayout.EndHorizontal();
32
33 GUILayout.EndScrollView();
34
35 GUI.EndGroup();
36 */
37
38 /*
39 scrollPosition = GUI.BeginScrollView(new Rect(10, 0, 280, 100), scrollPosition, new Rect(0, 0, 220, 200));
40 GUI.Button(new Rect(0, 0, 100, 20), "Top-left");
41 GUI.Button(new Rect(120, 0, 100, 20), "Top-right");
42 GUI.Button(new Rect(0, 180, 100, 20), "Bottom-left");
43 GUI.Button(new Rect(120, 180, 100, 20), "Bottom-right");
44 GUI.EndScrollView();
45 * */
46 }
47 }
2 using System.Collections;
3
4 public class AchievementLayer : MonoBehaviour {
5
6 private Vector2 scrollPosition;
7 private Rect bounds;
8
9 private void Start()
10 {
11 scrollPosition = Vector2.zero;
12 bounds = new Rect(128, 68, 538, 322);
13 }
14
15 private void OnGUI()
16 {
17
18 /*
19 GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(Screen.width / 800f, Screen.height / 480f, 1f));
20 GUI.BeginGroup(bounds);
21
22 // GUILayout.BeginHorizontal(GUILayout.Width(538), GUILayout.Height(322));
23
24 GUILayout.BeginScrollView(scrollPosition, GUIStyle.none);
25
26 for (int i = 0; i < 100; i++)
27 {
28 // GUI.Button(new Rect(0, 100 * i, 100, 30), "asdasdadsasd");
29 GUILayout.Button("aaaaaa");
30 }
31 //GUILayout.EndHorizontal();
32
33 GUILayout.EndScrollView();
34
35 GUI.EndGroup();
36 */
37
38 /*
39 scrollPosition = GUI.BeginScrollView(new Rect(10, 0, 280, 100), scrollPosition, new Rect(0, 0, 220, 200));
40 GUI.Button(new Rect(0, 0, 100, 20), "Top-left");
41 GUI.Button(new Rect(120, 0, 100, 20), "Top-right");
42 GUI.Button(new Rect(0, 180, 100, 20), "Bottom-left");
43 GUI.Button(new Rect(120, 180, 100, 20), "Bottom-right");
44 GUI.EndScrollView();
45 * */
46 }
47 }
GUILayout.BeginHorizontal(GUILayout.Width(538), GUILayout.Height(322));
GUI.Button(new Rect(0, 100 * i, 100, 30), "asdasdadsasd");
GUILayout.EndHorizontal();